Class FeinduraBase File source: /library/classes/FeinduraBase.class.php

Class Overview


		    
            
        
		

Description

The basis feindura class for the implementation classes.

It's methods provide necessary functions for the feindura and the feinduraModules classes.


Additional
Version
  • 1.59
    ChangeLog
    • 1.59 changed it to a PHP5 class, add visibilities (public, protected, private)
    • 1.58 add phpDocumentor documentation
    • 1.57 startet documentation
Class located in /library/classes/FeinduraBase.class.php [in line 41]
Descendants
Child Class Description
Feindura The class for implementing feindura - Flat File Content Management System in a website.
Property Summary
string   $sessionId   Contains the session-ID, if cookies are deactivated
array   $varNames   Contains the variable names used for the $_GET variables
bool   $loggedIn   Is TRUE when the user is logged into the backend of feindura and visits the frontend website.
array   $adminConfig   Contains the administrator-settings and the page-settings set in the CMS backend
array   $websiteConfig   Contains the website-settings config set in the CMS backend
array   $categoryConfig   Contains the categories-settings config set in the CMS backend
string   $language   A country code (example: de, en, ..) to set the language of the frontend language-files
array   $languageFile   Contains the frontend language-file array
Method Summary
void   __construct()   The constructor of the class, sets all basic properties. First gets all settings config arrays and external...
int|false   getCurrentPageId()   Returns the current page ID from the $_GET variable. Gets the current page ID from the $_GET variable. If...
int|false   getCurrentCategoryId()   Returns the current category ID from the $_GET variable. Gets the current category ID from the $_GET variable....
string   replaceLinks()   Replaces all feindura links (e.g. "?feinduraPageID=3") inside the given $pageContentString parameter,...
int|false   setCurrentPageId()   Sets the current page ID from the $_GET variable to the $page property. Gets the current page ID from the $_GET...
int|false   setCurrentCategoryId()   Sets the current category ID from the $_GET variable to the Feindura::$category property. Gets the current...
string   loadFrontendLanguageFile()   Loads the frontend language file into the $languageFile property.
array   generatePage()   This method uses the $showErrors, $titleLength and $thumbnailAlign properties. Generates a page. This method is...
string   createTitle()   Generates a page title from a given $pageContent array by using the given parameters.
array|false   createThumbnail()   Generates a thumbnail <img> tag from the given $pageContent array and returns an array with the ready to...
string   createAttributes()   Generates a string with a given id, class and other attributes. Check whether the given parameters are strings or...
array|false   loadPagesByType()   Load pages by ID-type and ID(s). If the $idType parameter start with "cat" it takes the given $ids...
array|false   loadPagesByDate()   Loads pages by ID-type and ID, which fit in the given time period parameters. Checks if the pages to load have a...
array|false   compareTags()   Compares the given tags with the tags in the given $pageContent array. If the given $pageContent array has one...
array|false   hasTags()   Load pages by ID-type and ID(s), but only if the page(s) have one or more tags from the given $tags parameter....
array|false   getPropertyIdsByString()   Gets the right page and category IDs. If the $ids parameter is a an array it uses the first value as page ID and...
int|false   getPropertyIdsByType()   If $ids parameter is FALSE it check the ID-type and returns then the Feindura::$page or Feindura::$category...
mixed   getPropertyPage()   Returns the Feindura::$page property if the given $page parameter is a Boolean.
int|true   getPropertyCategory()   Returns the Feindura::$category property if the given $category parameter is a Boolean.
string   shortenText()   Shorten a text by to a given length. If the $endString parameter is set and a $pageContent array is given, it...
string   shortenHtmlText()   Shorten a HTML text by to a given length. All HTML tags which are contained in the shortend text will be counted...
Properties
string $sessionId = null

Default value

null

Description

Contains the session-ID, if cookies are deactivated

This session ID is then placed on the end of every link.


Used By
Additional
  • access: protected
array $varNames = array('page' => 'page', 'category' => 'category', 'modul' => 'modul')

Default value

array('page' => 'page', 'category' => 'category', 'modul' => 'modul')

Description

Contains the variable names used for the $_GET variables

This variable names are configured in the feindura adminstrator-settings and set in the FeinduraBase() constructor to the this property.
For standard value see above.

Example of a link using the standard variable names: http://www.examplepage.com/index.php?category=1&page=6


Used By
Additional
  • see: FeinduraBase()
  • access: protected
bool $loggedIn = false

Default value

false

Description

Is TRUE when the user is logged into the backend of feindura and visits the frontend website.

If TRUE, it will enable the the frontend editing feature.


Used By
Additional
  • access: public
array $adminConfig

Default value

Description

Contains the administrator-settings and the page-settings set in the CMS backend

The file with the administrator-settings config array is situated at "feindura-CMS/config/admin.config.php".

This settings will be set to this property in the FeinduraBase constructor.

Example array:

  1. <?php
  2.  
  3. $adminConfig['url'=              'http://localhost';
  4. $adminConfig['basePath'=         '/feinduraCMS/';
  5. $adminConfig['realBasePath'=     '/var/server/feinduraCMS/';
  6. $adminConfig['websitePath'=      '/'// it's also possible: "/index.php"
  7. $adminConfig['uploadPath'=       '/feinduraCMS/upload/';
  8. $adminConfig['websiteFilesPath''';
  9. $adminConfig['stylesheetPath'=   '/styles/';
  10. $adminConfig['dateFormat'=       'int'// can be "int" or "eu"
  11. $adminConfig['speakingUrl'=      false;
  12.  
  13. $adminConfig['varName']['page'=     'page';
  14. $adminConfig['varName']['category''category';
  15. $adminConfig['varName']['modul'=    'modul';
  16.  
  17. $adminConfig['user']['editWebsiteFiles'false;
  18. $adminConfig['user']['editStyleSheets'=  false;
  19. $adminConfig['user']['info'=             '';
  20.  
  21. $adminConfig['setStartPage'=            true;
  22. $adminConfig['pages']['createDelete'=     true;
  23. $adminConfig['pages']['thumbnails'true;
  24. $adminConfig['pages']['plugins'=         false;
  25. $adminConfig['pages']['showTags'=        false;
  26.  
  27. $adminConfig['editor']['enterMode'=  'p';
  28. $adminConfig['editor']['styleFile'=  '/styles/sheet.css';
  29. $adminConfig['editor']['styleId'=    'contentId';
  30. $adminConfig['editor']['styleClass''';
  31.  
  32. $adminConfig['pageThumbnail']['width'=  '115';
  33. $adminConfig['pageThumbnail']['height''';
  34. $adminConfig['pageThumbnail']['ratio'=  'x';
  35. $adminConfig['pageThumbnail']['path'=   'thumbnails/'// relativer to the ['uploadPath']
  36.  
  37. ?>


Used By
Additional
array $websiteConfig

Default value

Description

Contains the website-settings config set in the CMS backend

The file with the website-settings config array is situated at "feindura-CMS/config/website.config.php".

This settings will be set to this property in the FeinduraBase constructor.

Example array:

  1. <?php
  2.  
  3. $websiteConfig['title']          'Example Website';
  4. $websiteConfig['publisher']      'Puslisher';
  5. $websiteConfig['copyright']      'Copyrightholder';
  6. $websiteConfig['keywords']       'keyword1,keyword2,keyword3,keyword4';
  7. $websiteConfig['description']    'This example website is intended to show how easy it is to use feindura CMS.';
  8. $websiteConfig['email']          'info@examplewebsite.com';
  9.  
  10. $websiteConfig['startPage']      1;
  11.  
  12. ?>


Used By
Additional
array $categoryConfig

Default value

Description

Contains the categories-settings config set in the CMS backend

The file with the categories-settings config array is situated at "feindura-CMS/config/category.config.php".

This settings will be set to this property in the FeinduraBase constructor.

Example array:

  1. <?php
  2.  
  3. $categoryConfig[1]['id'=              1;
  4. $categoryConfig[1]['name'=            'Example Category 1';
  5. $categoryConfig[1]['public'=          true;
  6. $categoryConfig[1]['createDelete'=    true;
  7. $categoryConfig[1]['thumbnail'=       true;
  8. $categoryConfig[1]['plugins'=         true;
  9. $categoryConfig[1]['showTags'=        true;
  10. $categoryConfig[1]['showPageDate'=    true;
  11. $categoryConfig[1]['sorting'=         'byPageDate';
  12.  
  13. $categoryConfig[1]['styleFile'=       '/styles/sheet.css';
  14. $categoryConfig[1]['styleId'=         'contentId';
  15. $categoryConfig[1]['styleClass'=      'contentClass';
  16.  
  17. $categoryConfig[1]['thumbWidth'=      '100';
  18. $categoryConfig[1]['thumbHeight'=     '';
  19. $categoryConfig[1]['thumbRatio'=      'x';
  20.  
  21.  
  22. $categoryConfig[2]['id'=              2;
  23. $categoryConfig[2]['name'=            'Example Category 2';
  24. $categoryConfig[2]['public'=          false;
  25. $categoryConfig[2]['createDelete'=    false;
  26. $categoryConfig[2]['thumbnail'=       false;
  27. $categoryConfig[2]['plugins'=         false;
  28. $categoryConfig[2]['showTags'=        false;
  29. $categoryConfig[2]['showPageDate'=    false;
  30. $categoryConfig[2]['sorting'=         'manually';
  31.  
  32. $categoryConfig[2]['styleFile'=       '';
  33. $categoryConfig[2]['styleId'=         '';
  34. $categoryConfig[2]['styleClass'=      '';
  35.  
  36. $categoryConfig[2]['thumbWidth'=      '150';
  37. $categoryConfig[2]['thumbHeight'=     '100';
  38. $categoryConfig[2]['thumbRatio'=      '';
  39.  
  40. ...
  41.  
  42. ?>


Used By
Additional
string $language = 'en'

Default value

'en'

Description

A country code (example: de, en, ..) to set the language of the frontend language-files

This country code is used to include the right frontend language-file. The frontend language-file is used when displaying page warnings or errors and additional texts like "more", etc.
This property will be set in the feindura constructor.

The standard value is "en" (english).


Used By
Additional
array $languageFile = null

Default value

null

Description

Contains the frontend language-file array

The frontend language file array contains texts for displaying page warnings or errors and additional texts like "more", etc.
The file is situated at "feindura-CMS/library/languages/de.frontend.php".

It will be included and set to this property in the FeinduraBase constructor.


Used By
Additional
  • see: FeinduraBase()
  • access: public
Methods
File source:
line 221
void Constructor __construct ( [string $language = false])

Parameters

string $language (optional) A country code "de", "en", ... to load the right frontend language-file and will be set to the $language property
Default false

Redefined in descendants as:

Description

Type constructor

The constructor of the class, sets all basic properties.

First gets all settings config arrays and external classes.
Then Check if the visitor is a logged in user of the feindura backend and set the FeinduraBase::$loggedIn property. Then set the $_GET variable names from the administrator-settings config to the $varNames property.
Check if cookies are activated, otherwise store the session ID in the $sessionId property for use in links.
Get the the given $language parameter or try to find the browser language and load the frontend language-file and set it to the $languageFile property.

Used Global Variables

  • $adminConfig the administrator-settings config (included in the general.include.php)
  • $websiteConfig the website-settings config (included in the general.include.php)
  • $categoryConfig the categories-settings config (included in the general.include.php)


Used By
Uses
Additional
  • example: example
  • access: protected
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 304
int|false getCurrentPageId ( )

Description

Name getCurrentPageId()
Alias getPageId()

Returns the current page ID from the $_GET variable.

Gets the current page ID from the $_GET variable. If $_GET is not a ID but a page name, it loads all pages in an array and look for the right page name and returns the ID. If no $_GET variable exists try to return the Feindura::$startPage property.

Used Global Variables

  • $_GET to fetch the page ID


Used By
Uses
Return Value
  • int|false - the current page ID or FALSE
Additional
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 383
int|false getCurrentCategoryId ( )

Description

Name getCurrentCategoryId()
Alias getCategoryId()

Returns the current category ID from the $_GET variable.

Gets the current category ID from the $_GET variable. If $_GET is not a ID but a category name, it look in the FeinduraBase::$categoryConfig for the right category ID. If no $_GET variable exists it try to return the Feindura::$startPage property.

Used Global Variables

  • $_GET to fetch the category ID


Used By
Uses
Return Value
  • int|false - the current category ID or FALSE
Additional
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 439
string replaceLinks ( string $pageContentString)

Parameters

string $pageContentString the page content string, to replace all feindura links, with real hrefs

Description

Name replaceLinks()

Replaces all feindura links (e.g. "?feinduraPageID=3") inside the given $pageContentString parameter, with real href links.


Uses
Return Value
  • string - the $pageContentString woth replaced feindura links
Additional
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 476
int|false setCurrentPageId ( [bool $setStartPage = false])

Parameters

bool $setStartPage (optional) If set to TRUE it also sets the Feindura::$startPage property
Default false

Description

Name setCurrentPageId()
Alias setPageId()

Sets the current page ID from the $_GET variable to the $page property.

Gets the current page ID from the $_GET variable (through getCurrentPageId) and set it to the $page property. If the $setStartPage parameter is TRUE and the Feindura::$category is empty, the Feindura::$startPage property will also be set with the start page ID from the $websiteConfig.


Used By
Uses
Return Value
  • int|false - the set page ID or FALSE
Additional
  • access: protected
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 524
int|false setCurrentCategoryId ( [bool $setStartCategory = false])

Parameters

bool $setStartCategory (optional) If set to TRUE it also sets the $startCategory property
Default false

Description

Name setCurrentCategoryId()
Alias setCategoryId()

Sets the current category ID from the $_GET variable to the Feindura::$category property.

Gets the current category ID from the $_GET variable (through getCurrentCategoryId) and set it to the Feindura::$category property. If the $setStartCategory parameter is TRUE the $startCategory property will also be set with the startpage ID from the $websiteConfig.


Used By
Uses
Return Value
  • int|false - the set category ID or FALSE
Additional
  • access: protected
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 565
string loadFrontendLanguageFile ( [string $language = false])

Parameters

string $language (optional) a given country code which will be used to try to load the language file
Default false

Description

Name loadFrontendLanguageFile()

Loads the frontend language file into the $languageFile property.


Uses
Return Value
  • string - the country code which was used to load the frontend language files
Additional
  • access: protected
Version
  • 1.1
    ChangeLog
    • 1.1 add new GeneralFunctions::loadLanguageFile() method
    • 1.0 initial release
File source:
line 655
array generatePage ( int|array $page,
[bool $showErrors = true],
[int|array|bool $shortenText = false],
[bool|string $useHtml = true])

Parameters

int|array $page page ID or a $pageContent array
bool $showErrors (optional) says if errors like "The page you requested doesn't exist" will be displayed
Default true
int|array|bool $shortenText (optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>')
Default false
bool|string $useHtml (optional) displays the page content with or without HTML tags. It also accepts a string with allowed html tags.
Default true

Description

Name generatePage()

This method uses the $showErrors, $titleLength and $thumbnailAlign properties.

Generates a page.

This method is called in descendant classes.
Generates a page by the given page ID. An array will be returned with all elements of the page, ready for displaying in a HTML-page.

In case the page doesn't exists or is not public and the $showErrors parameter is TRUE, an error will be placed in the ['content'] part of the returned array, otherwiese it returns an empty array.

Example of the returned array:

  1. <?php
  2.  
  3. array(
  4.   'id' => 1,
  5.   'category' => 'Example Category',
  6.   'pageDate' => '2000-12-31'// format depending on the administrator-settings
  7.   'pageDateTimestamp' => 1325393999,
  8.   'title' => 'Title Example',
  9.   'thumbnail' => '<img src="/path/thumb_page1.png" alt="Thumbnail" title="Title Example" />',
  10.   'thumbnailPath' => '/path/thumb_page1.png',
  11.   'content' => "\n".'<p>Content Text</p>'."\n"// the content has line breaks before and after
  12.   'description' => 'Short description of the page',
  13.   'tags' => 'tag1 tag2 tag3',
  14.   'plugins' => array(
  15.           'imageGallery' => array(
  16.               'active'          true,
  17.               'galleryPath'     '/upload/gallery/',
  18.               'imageWidth'      800,
  19.               'imageHeight'     null,
  20.               'thumbnailWidth'  160,
  21.               'thumbnailHeight' null,
  22.               'tag'             'table',
  23.               'breakAfter'      3
  24.           ),
  25.           'pageRating' => array(
  26.               'active' false,
  27.               'value'  0,
  28.               'votes'  0
  29.           )
  30.       )
  31.   )
  32.  
  33. ?>


Used By
Uses
Return Value
  • array - the generated page array, ready to display in a HTML file
Additional
Version
  • 1.0.1
    ChangeLog
    • 1.0.1 fixed description return
    • 1.0 initial release
File source:
line 875
string createTitle ( array $pageContent,
[int $titleLength = false],
[bool $titleAsLink = false],
[bool $titleShowPageDate = false],
[bool $titleShowCategory = false],
[ $titlePageDateSeparator = false],
[string $titleCategorySeparator = false])

Parameters

array $pageContent the $pageContent Array of a page
int $titleLength (optional) number of the maximal text length shown or FALSE to not shorten
Default false
bool $titleAsLink (optional) if TRUE, it creates the title as link
Default false
bool $titleShowPageDate (optional) if TRUE, it shows the page date before the title text
Default false
bool $titleShowCategory (optional) if TRUE, it shows the category name before the title text, and uses the $titleShowCategory parameter string between both
Default false
string $titleCategorySeparator (optional) string to seperate the category name and the title text, if the $titleShowCategory parameter is TRUE
Default false
$titlePageDateSeparator
Default false

Description

Name createTitle()

Generates a page title from a given $pageContent array by using the given parameters.


Used By
Uses
Return Value
  • string - the generated title string ready to display in a HTML file
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 959
array|false createThumbnail ( array $pageContent)

Parameters

array $pageContent the $pageContent array of a page

Description

Name createThumbnail()

Generates a thumbnail <img> tag from the given $pageContent array and returns an array with the ready to display tag and the plain thumbnail path.

Used Constants

  • DOCUMENTROOT the absolut path of the webserver


Used By
Uses
Return Value
  • array|false - the generated thumbnail <img> tag and a the plain thumbnail path or FALSE if no thumbnail exists or is not allowed to show
Additional
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1022
string createAttributes ( string|number $id,
string|number $class,
string|number $attributes)

Parameters

string|number $id a HTML id attribute value
string|number $class a HTML class attribute value
string|number $attributes one or more 'key="values"' attributes

Description

Name createAttributes()

Generates a string with a given id, class and other attributes.

Check whether the given parameters are strings or numbers and add them to a string with attributes.

Example return: 'id="exampleId" class="exampleClass" key="value"'


Used By
Return Value
  • string - the generated attribute string
Additional
  • access: protected
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1073
array|false loadPagesByType ( string $idType,
int|array|bool $ids)

Parameters

string $idType the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages"
int|array|bool $ids the category or page ID(s), can be a number or an array with numbers, if TRUE it loads all pages

Description

Name loadPagesByType()

Load pages by ID-type and ID(s).

If the $idType parameter start with "cat" it takes the given $ids parameter as category IDs.
If the $idType parameter start with "pag" it takes the given $ids parameter as page IDs.
While it is not important that whether the $idType parameter is written in plural or singular. The $ids parameter is automaticly checked whether its an array with IDs or a single ID.

Example of the returned $pageContent array: (Note This array will be wraped in another array, not shown here)

  1. <?php
  2.  
  3. array(
  4.     "id" => 2,
  5.     "category" => 1,
  6.     "public" => true,
  7.     "sortOrder" => 4,
  8.     "lastSaveDate" => 1282348800// UNIX-Timestamp
  9.     "lastSaveAuthor" => 'fooMan',
  10.     "title" => 'Example Page 2',
  11.     "description" => '',
  12.     "pageDate" => array(
  13.                   "before" => 'text before date',
  14.                   "date" => 1282348800,
  15.                   "after" => 'text after date'
  16.                 ),  
  17.     "tags" => 'winter summer',
  18.     "plugins" => array(
  19.                   "plugin1" => array(
  20.                               "active" => true,
  21.                               "exampleConfigString" => 'example/path/',
  22.                               "exampleConfigNumber" => 500
  23.                             ),
  24.                   "plugin2" => array(
  25.                               "active" => true,
  26.                               "exampleConfigBool1" => false,
  27.                               "exampleConfigBool2" => true,
  28.                             )
  29.                 ),
  30.     "thumbnail" => 'thumb_page2.jpg',
  31.     "styleFile" => 'a:0:{}',  // serialized array
  32.     "styleId" => '',
  33.     "styleClass" => '',
  34.     "content" => '<p>Example Content</p>'
  35.     )
  36.  
  37. ?>


Used By
Uses
Return Value
  • array|false - an array with $pageContent array(s)
Additional
  • access: protected
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1194
array|false loadPagesByDate ( string $idType,
int|array|bool $ids,
[int|bool|string $monthsInThePast = true],
[int|bool|string $monthsInTheFuture = true],
[bool $sortByCategories = false],
[bool $reverseList = false])

Parameters

string $idType the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages"
int|array|bool $ids the category or page ID(s), can be a number or an array with numbers, if TRUE it loads all pages
int|bool|string $monthsInThePast (optional) number of months before today, if TRUE it show all pages in the past, if FALSE it loads only pages starting from today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php
Default true
int|bool|string $monthsInTheFuture (optional) number of months after today, if TRUE it show all pages in the future, if FALSE it loads only pages until today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php
Default true
bool $sortByCategories (optional) determine whether the pages should only by sorted by page date or also seperated by categories and sorted by page date
Default false
bool $reverseList (optional) if TRUE the pages sorting will be reversed
Default false

Description

Name loadPagesByDate()

Loads pages by ID-type and ID, which fit in the given time period parameters.

Checks if the pages to load have a page date and the page date fit in the given $monthsInThePast and $monthsInTheFuture parameters. All time period parameters are compared against the date of TODAY.

The $monthsInThePast and $monthsInTheFuture parameters can also be a string with a (relative or specific) date, for more information see: http://www.php.net/manual/de/datetime.formats.php.


Used By
Uses
Return Value
  • array|false - an array with the $pageContent arrays or FALSE if no page has a page date or is allowed for sorting
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1301
array|false compareTags ( array $pageContent,
array $tags)

Parameters

array $pageContent the $pageContent array of a page
array $tags an array with tags to compare

Description

Name compareTags()

Compares the given tags with the tags in the given $pageContent array.

If the given $pageContent array has one or more tags from the $tags parameter, it returns the $pageContent array otherwise it FALSE.
Notice: the tags will be compared case insensitive.


Used By
Return Value
  • array|false - the $pageContent array or FALSE if the $pageContent['tags'] doesn't match with any of the given tags
Additional
Version
  • 1.0.1
    ChangeLog
    • 1.0.1 fixed comparision, beacause i changed separarion of tags from whitespace to ,
    • 1.0 initial release
File source:
line 1353
array|false hasTags ( string $idType,
int|array|bool $ids,
string|array $tags)

Parameters

string $idType the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages"
int|array|bool $ids the category or page ID(s), can be a number or an array with numbers, if TRUE it checks all pages tags
string|array $tags an string (seperated by "," or ";" or " ") or an array with tags to compare

Description

Name hasTags()

Load pages by ID-type and ID(s), but only if the page(s) have one or more tags from the given $tags parameter.

Notice: the tags will be compared case insensitive.


Used By
Uses
Return Value
  • array|false - the $pageContent array of $pageContent arrays or FALSE if no $pageContent array have the any of the given tags
Additional
Version
  • 1.0.1
    ChangeLog
    • 1.0.1 fixed issue when get a single tag as string
    • 1.0 initial release
File source:
line 1444
array|false getPropertyIdsByString ( int|string|array|bool $ids)

Parameters

int|string|array|bool $ids a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". (See example) (can also be a $pageContent array)

Description

Name getPropertyIdsByString()

Gets the right page and category IDs. If the $ids parameter is a an array it uses the first value as page ID and the second as category ID.

If the given $ids parameter is a string/array with "previous" or "next" it returns the previous or next page ID from the current Feindura::$page property/Feindura::$category property on. If the given $ids parameter is a string/array with "first" or "last" it returns the first or last page ID in that category from the current Feindura::$page property/Feindura::$category property on. If the string is "random" it returns a random page ID in the current category, if its an array like: array('random','random') it would return a random page ID from a random category.

Notice: What is the first or last page/category depends on the sorting you have of the pages/categories in the feindura backend. Notice: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one.

Examples of possible $ids parameter.

  1.  <?php
  2.  false                  // return the ids of the current $page property
  3.  2                      // would return an array with the associated category of that page: array(2,1)
  4.  'next'                 // would return the next page, after the current $page property in the current category
  5.  array('next',false)    // the same as above
  6.  array('next',45)       // the same as above (it would discard the wrong category ID)
  7.  array('next','next')   // same as above (it would discard the wrong category ID)
  8.  array(false,'next')    // would return the first page of the next category, in the $categoryConfig property
  9.  array('last','next')   // would return the last page of the next category, in the $categoryConfig property
  10.  array('last','first')  // would return the last page of the first category, in the $categoryConfig property
  11.  array('last','first')  // would return the last page of the first category, in the $categoryConfig property
  12.  array('rand','rand')   // would return a random page of a random category, in the $categoryConfig property
  13.  ?>

Example return value, where first value is the page ID and the second value is the category ID. array(2,1)


Used By
Uses
Return Value
  • array|false - array with the page ID and category ID of the right page, or FALSE if no page could be resolved (e.g. last page and "next"). (will also pass through a given $pageContent array)
Additional
  • access: protected
Version
  • 2.0
    ChangeLog
    • 2.0 change name from loadPrevNextPage() to getPropertyIdsByString(), and now handles also categories
    • 1.0 initial release
File source:
line 1670
int|false getPropertyIdsByType ( string $idType,
int|array|bool $ids)

Parameters

string $idType the ID type can be "page", "pages" or "category", "categories"
int|array|bool $ids the category or page ID(s), if they are FALSE it returns the property ID, otherwise it passes the ID(s) through

Description

Name getPropertyIdsByType()

If $ids parameter is FALSE it check the ID-type and returns then the Feindura::$page or Feindura::$category property.


Used By
Return Value
  • int|false - a page or category property ID or FALSE, if there are no property IDs
Additional
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1712
mixed getPropertyPage ( [int|bool $page = false])

Parameters

int|bool $page (optional) a page id or a boolean
Default false

Description

Name getPropertyPage()

Returns the Feindura::$page property if the given $page parameter is a Boolean.


Return Value
  • mixed - either the Feindura::$page property or passes the $page parameter
Additional
  • access: protected
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1735
int|true getPropertyCategory ( [int|bool $category = false])

Parameters

int|bool $category (optional) a category id or a boolean
Default false

Description

Name getPropertyCategory()

Returns the Feindura::$category property if the given $category parameter is a Boolean.


Used By
Return Value
Additional
  • access: protected
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1769
string shortenText ( string $string,
int|array $length,
[array|false $pageContent = false],
[string|false $endString = " ..."])

Parameters

string $string the string to shorten
int|array $length the number of maximal characters, or an array with a number for text length and the more string, or a bool, whether to add the more link or not. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>')
array|false $pageContent (optional) the pageContent array of the page to create the "more" link to the page from
Default false
string|false $endString (optional) a string which will be put after the last character and before the "more" link
Default " ..."

Description

Name shortenText()

Shorten a text by to a given length.

If the $endString parameter is set and a $pageContent array is given, it adds the $endString parameter after the last character and a "more" link on the end of the shortened text.


Used By
Uses
Return Value
  • string - the shortened string
Additional
  • access: protected
Version
  • 1.1
    ChangeLog
    • 1.1 $length parameter can now be an array
    • 1.0 initial release
File source:
line 1831
string shortenHtmlText (  $input,
int|array $length,
[array|false $pageContent = false],
[string|false $endString = ' ...'],
string $string)

Parameters

string $string the string to shorten
int|array $length the number of maximal characters, or an array with a number for text length and the more string, or a bool, whether to add the more link or not. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>')
array|false $pageContent (optional) the pageContent array of the page to create the "more" link to the page from
Default false
string|false $endString (optional) a string which will be put after the last character and before the "more" link
Default ' ...'
$input

Description

Name shortenHtmlText()

Shorten a HTML text by to a given length.

All HTML tags which are contained in the shortend text will be counted and closed on the end.
If the $endString parameter is set and a $pageContent array is given, it adds the $endString parameter after the last character and a "more" link on the end of the shortened text.


Used By
Uses
Return Value
  • string - the shortened string
Additional
  • access: protected
Version
  • 1.1
    ChangeLog
    • 1.1 $length parameter can now be an array
    • 1.0 initial release